@using ZKEACMS.Shop.ViewModel
@model OrderListViewModel
@{
    Layout = Layouts.CustomerCenter;
    ViewBag.Title = L("我的订单").Text;
}
<div class="panel panel-default">
    <div class="panel-heading">
        @L("我的订单")
    </div>
    <table class="table table-striped table-hover table-response">
        <thead>
            <tr>
                <th>
                    @L("订单号")
                </th>
                <th>
                    @L("金额")
                </th>
                <th>
                    @L("联系人")
                </th>
                <th>
                    @L("联系电话")
                </th>
                <th>
                    @L("收货地址")
                </th>
                <th>
                    @L("订单日期")
                </th>
                <th>
                    @L("状态")
                </th>
                <th>
                    @L("操作")
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.Orders)
            {
                <tr class="@(item.OrderStatus == (int)ZKEACMS.Shop.OrderStatus.UnPaid ? "warning" : "")">
                    <td head="@L("订单号")">
                        <a href="@Url.Action("Detail", new { Id = item.ID })">@item.ID</a>
                    </td>
                    <td head="@L("金额")">
                        @item.Total.ToString("F2")
                    </td>
                    <td head="@L("联系人")">
                        @item.Contact
                    </td>
                    <td head="@L("联系电话")">
                        @item.PhoneNumber
                    </td>
                    <td head="@L("收货地址")">
                        @item.ShippingAddress
                    </td>
                    <td head="@L("订单日期")">
                        @item.CreateDate.Value.ToString("yyyy/MM/dd")
                    </td>
                    <td head="@L("状态")">
                        @item.OrderStatusText()
                    </td>
                    <td head=" @L("操作")">
                        @if (item.OrderStatus == (int)ZKEACMS.Shop.OrderStatus.UnPaid)
                        {
                            <a href="@Url.Action("Pay", "AliPay", new { orderId = item.ID })">@L("付款")</a>
                        }
                        <a class="remove-order" href="javascript:" data-href="@Url.Action("Remove", new { Id = item.ID })">@L("删除")</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
@{
    await Html.Pagin(Model.Pagin);
}
@using (Script.AtFoot())
{
    <script type="text/javascript">
        $(document).on("click", ".remove-order", function () {
            var href = $(this).data("href");
            Easy.ShowMessageBox('@L("提示")', '@L("确定删除订单吗？")', function () { window.location.href = href; }, true);
        });
    </script>

}